//
//  UIImage+CQTagListBundle.m
//  AppCommonUICollect
//
//  Created by ciyouzen on 2018/7/3.
//  Copyright © 2018年 dvlproad. All rights reserved.
//

#import "UIImage+CQTagListBundle.h"

@implementation UIImage (CQTagListBundle)

/// 标签列表的"添加"按钮图片
+ (UIImage *)taglist_image_add {
    UIImage *addImage = [UIImage cqTagListBundle_imageNamed:@"icon_add_tag"];
    return addImage;
}

/// 标签列表的"编辑"按钮图片
+ (UIImage *)taglist_image_edit {
    UIImage *addImage = [UIImage cqTagListBundle_imageNamed:@"icon_info_edit"];
    return addImage;
}

#pragma mark - 基础接口
+ (nullable UIImage *)cqTagListBundle_imageNamed:(NSString *)name {
    if(name.length == 0) {
        return nil;
    }
    
    NSBundle *bundle = [NSBundle bundleForClass:NSClassFromString(@"UIImage+CQTagListBundle")];//此处不能使用UIImage作为获取bundle的类
    if (bundle == nil) {
        return nil;
    }
    NSURL *url = [bundle URLForResource:@"CQTagListBundle" withExtension:@"bundle"];
    if (url == nil) {
        return nil;
    }
    NSBundle *imageBundle = [NSBundle bundleWithURL:url];
    UIImage *image = [UIImage imageNamed:name inBundle:imageBundle compatibleWithTraitCollection:nil];
    return image;
}

@end
